package com.woody.aggregate.msgsendrule.api;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.woody.aggregate.msgsendrule.req.*;
import com.woody.aggregate.msgsendrule.vo.*;
import com.woody.base.model.Response;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

/**
 * &copy; All rights Reserved
 *
 * @author wénkǎi.zhāng 2025-03-18
 */
public interface MsgSendRuleApi {

    @PostMapping("list")
    @ApiOperation(value = "查询弹窗规则列表", notes = "查询弹窗规则列表")
    Response<Page<MsgSendRuleVo>> listRule(@Valid @RequestBody(required = false) ListMsgSendRuleReq request);

    @GetMapping("detail/{ruleId}")
    @ApiOperation(value = "根据规则id查询规则详情", notes = "根据规则id查询规则详情")
    @ApiImplicitParam(name = "ruleId", value = "规则id", required = true)
    Response<MsgSendRuleInfoVo> queryRuleDetailById(@PathVariable(value = "ruleId") Integer ruleId);

    @PostMapping("save")
    @ApiOperation(value = "新增/编辑弹窗规则", notes = "新增/编辑弹窗规则")
    Response<SaveMsgSendRuleVo> saveRule(@Valid @RequestBody SaveMsgSendRuleReq request);

    @PostMapping("targetList")
    @ApiOperation(value = "分页查询规则用户列表", notes = "规则详情页，分页查询规则用户列表")
    Response<Page<RuleTargetInfoVo>> listSelectedTarget(@Valid @RequestBody ListSelectedTargetReq request);

    @PostMapping("queryBoundTargetIds")
    @ApiOperation(value = "查询已绑定的用户列表", notes = "根据规则id和用户列表，筛选并返回已绑定该规则的用户列表")
    Response<List<Long>> queryBoundTargetIds(@Valid @RequestBody QueryBoundTargetIdsReq request);

    @PostMapping("updateTarget")
    @ApiOperation(value = "更新规则已选中门店", notes = "编辑规则时新增或删除指定门店")
    Response<Void> updateTargetRef(@Valid @RequestBody UpdateSelectedUserListReq request);

    @DeleteMapping("delete/{ruleId}")
    @ApiOperation(value = "根据规则id删除弹窗规则", notes = "根据规则id删除弹窗规则")
    @ApiImplicitParam(name = "ruleId", value = "规则id", required = true)
    Response<Void> deleteRule(@PathVariable(value = "ruleId") Integer ruleId);


}
